<?php
include(dirname(__FILE__) . "/../favorite-service-adapter.php");
include_once("account.php");

$user_id = GetLoginId($_COOKIE['t']);
if (!$user_id || $user_id <= 0) {
  $host = $_SERVER['HTTP_HOST'];
  header('Location: http://' . $host . '/account/login.php?d=' . urlencode('http://' . $host . '/account/my.php'));
} else {
  $res_word = "登录成功, id = " . $user_id;
}
$page_title = "我的价值投资派";
include("../header.php");
?>


<div class="container">
	<div class="main">
		<div class="content">
			<div class="articles">

<?php
$conn = mysql_connect("127.0.0.1","root","");
$account = GetAccountInfo($user_id);

echo '<br/>';

$adapter = new FavoriteServiceAdapter();
$fav_articles = $adapter->GetMemberFavoriteArticles($user_id);
$fav_count = count($fav_articles);

echo '欢迎归来，<a href="/account/my.php">' . $account['nick'] . '(' . $account['email'] . ')</a>' . '，您收藏了' . $fav_count . '篇文章。 ';
echo '&nbsp; <a style="font-size:88%" href="' . $URL_LOGOUT_PAGE . '">退出登录</a><br/>';


mysql_select_db("xingtan");

for ($i = $fav_count - 1; $i >= 0; --$i) {
  ArticlePreview($fav_articles[$i]);
}

?>
		</div>
		</div>
	</div>
</div>

<?php
mysql_close($conn);
include("../footer.php");
?>

